package com.shop.cereshop.commons.enums.recommend;

import io.swagger.annotations.ApiModel;
import lombok.Getter;

@Getter
@ApiModel(value = "RecommendFootPrintEnum", description = "动态足迹枚举")
public enum RecommendFootPrintEnum {
    TEXT(1, "图文"),
    VIDEO(2, "视频"),
    USER(3, "用户"),
    LIVE(4, "直播");

    private final Integer code;
    private final String msg;

    RecommendFootPrintEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static String getMsgByCode(Integer code) {
        for (RecommendFootPrintEnum value : values()) {
            if (value.code.equals(code)) {
                return value.msg;
            }
        }
        return null;
    }

    public static Integer getCodeByMsg(String msg) {
        for (RecommendFootPrintEnum value : values()) {
            if (value.msg.equals(msg)) {
                return value.code;
            }
        }
        return -1;
    }
}
